package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202409;

public class leetcode20240916 {
    public int distanceBetweenBusStops(int[] distance, int start, int destination) {
        if(destination<start){
            int tmp=start;
            start=destination;
            destination=tmp;
        }
        int sum=0;
        for(int dis : distance){
            sum+=dis;
        }
        int sumSD=0;
        for(int i=start;i<destination;i++){
            sumSD+=distance[i];
        }
        return Math.min(sumSD,sum-sumSD);
    }
}
